<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<input type="button" id="btn" value="隐藏">
<div id="box" style="display: block">aaaaa</div>
<script>
    var btnObj = document.getElementById('btn');    //获得对象
    var boxObj = document.getElementById('box');    //获得对象
//    btnObj.onclick = function () {
//        //
//    }
    btnObj.onclick = function () {
        if (boxObj.style.display == 'block') {
            btnObj.value = '显示';
            boxObj.style.display = 'none';
        } else {
            btnObj.value = '隐藏';
            boxObj.style.display = 'block';
        }
    }



</script>

</body>
</html>